<template>
	<div>
		<el-card shadow="never">
			<div style="text-align: left;">
				<el-input class="x_soso" v-model="search.searchInput" placeholder="请输入方案名称搜索"></el-input>
				<el-select class="x_soso" filterable v-model="search.bodysType" placeholder="按部位类别搜索">
					<el-option v-for="(item, index) in bodysType" :key="index" :label="item.name" :value="item.id"></el-option>
				</el-select>
				<el-button type="primary" @click="searchList">查询</el-button>

			</div>
			<div style="text-align: left;">
				<el-button type="primary" @click="reloadVal">刷新</el-button>
				<el-button type="primary" @click="addColumnClick">
					<i class="el-icon-plus"></i>
					新增方案
				</el-button>
			</div>
			<div style="clear:both"></div>
			<el-table @sort-change='sortChange' v-loading="loading" :data="tableData" style="width: 100%;margin-top: 20px">
				<el-table-column type="index" width="50"></el-table-column>
				<el-table-column label="方案名称" align="center" width="150" prop="planName"></el-table-column>
				<el-table-column label="标签" align="center" width="150" prop="planLabel"></el-table-column>
				<!-- <el-table-column label="适用年龄段" align="center" width="150" prop="planAge"></el-table-column> -->
				<el-table-column label="方案图" align="center" width="150" prop="planImg">
					<template slot-scope="scope">
						<img :src="scope.row.planImg" min-width="70" height="70" />
					</template>
				</el-table-column>
				<el-table-column label="关联设备" align="center" width="150" prop="equType">
					<template scope="scope">
						<span v-if="scope.row.equType == 1">抗衰仪</span>
					</template>
				</el-table-column>
				<el-table-column label="总点数" :sortable="'custom'" align="center" width="150" prop="planDot"></el-table-column>
				<el-table-column label="总耗时" :sortable="'custom'" align="center" width="150" prop="planDate"></el-table-column>
				<el-table-column label="是否进入自由模式" align="center" width="150" prop="isOnly">
					<template scope="scope">
						<span v-if="scope.row.isOnly == true">是</span>
						<span v-if="scope.row.isOnly == false">否</span>
					</template>
				</el-table-column>
				<el-table-column label="创建时间" :sortable="'custom'" align="center" width="180" prop="createTime"></el-table-column>
				<el-table-column label="修改时间" align="center" width="180" prop="createTime"></el-table-column>
				<!-- <el-table-column fixed="right" label="停启用状态" align="center" width="150">
					<template slot-scope="scope">
						<el-switch v-model="scope.row.isEnabled" active-color="#13ce66" inactive-color="#dedede" active-text="启用"
						 inactive-text="停用" :active-value="1" :inactive-value="0" @change="changeSwitch(scope.$index, scope.row)"></el-switch>
					</template>
				</el-table-column> -->
				<el-table-column fixed="right" label="操作" align="center" width="250">
					<template slot-scope="scope">
						<el-button @click="cellClick(scope.row)" icon="el-icon-edit" type="warning" size="small">编辑</el-button>

					</template>
				</el-table-column>
			</el-table>
			<div style="margin-top: 20px;text-align: right">
				<el-pagination background @current-change="columnFind" :current-page="page.page" :page-size="page.pagesize" layout="prev, pager, next, jumper, total"
				 :total="page.count"></el-pagination>
			</div>
		</el-card>
		<el-dialog :title="cname" :visible.sync="dialogVisible" width="1000px" :close-on-click-modal="false">
			<el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm wrap_dislog">
				<el-form-item label="方案名称" class="dislog_item" style="width: 100%;">
					<el-input v-model="ruleForm.scenarioName" placeholder="请输入方案名称" maxlength="20"></el-input>
				</el-form-item>
				<el-form-item label="方案标签" class="dislog_item" style="width: 100%;">
					<div class="dislog_tip">
						<el-input v-model="ruleForm.planLabel" placeholder="请输入方案标签,使用'#'号隔开" style="width: 60%;" maxlength="20"></el-input>
						<span>使用#号隔开，例： 西北#年轻女性</span>
					</div>
				</el-form-item>
				<el-form-item label="方案耗点" class="dislog_item" style="width: 100%;">
					<el-input v-model="ruleForm.point" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" min="0" type="number" placeholder="请输入方案耗点"></el-input>
				</el-form-item>
				<el-form-item label="方案总时长" class="dislog_item" style="width: 100%;">
					<el-input v-model="ruleForm.totelTime" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" min="0" type="number" placeholder="请输入方案总时长"></el-input>
				</el-form-item>
				<el-form-item label="选择设备类型" class="dislog_item" style="width:100%;">
					<el-select filterable v-model="ruleForm.deviceType" style="width: 100%;" placeholder="选择设备类型">
						<el-option v-for="item in deviceType" :key="item.id" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="选择自由模式" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="ruleForm.stylesSelect" style="width: 100%;" placeholder="是否进入自由模式">
						<el-option v-for="item in stylesSelect" :key="item.id" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>
				<!-- <el-form-item label="选择年龄段" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="ruleForm.planAge" style="width: 100%;" placeholder="选择年龄段">
						<el-option v-for="item in ageList" :key="item.planAgeId" :label="item.planAgeData" :value="item.planAgeData"></el-option>
					</el-select>
				</el-form-item> -->
				<el-form-item label="选择方案类型" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="ruleForm.planType" style="width: 100%;" placeholder="按方案类型搜索">
						<el-option v-for="(item, index) in bodysType" :key="index" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>

				<el-form-item label="方案主图" class="dislog_item">
					<el-upload class="avatar-uploader" action="https://test.beauty-iot.com/appt/api/common/uploadImage"
					 :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
						<img v-if="imageUrl" :src="imageUrl" class="avatar" />
						<i v-else class="el-icon-plus avatar-uploader-icon"></i>
					</el-upload>
				</el-form-item>
				
				
				<div class="addLong">
					<div class="add_wrap" v-for="(aitem, index) in addList" :key="index">
						<div class="addLong_input" style="width: 18%;">
							<span class="label_name">部位</span>
							<el-select filterable v-model="addList[index].partType" style="width: 76%;" placeholder="选择详细部位">
								<el-option v-for="(item, index) in bodys" :key="index" :label="item.partTypeName" :value="item.partType"></el-option>
							</el-select>
						</div>
						<div class="addLong_input" style="width: 25%;">
							<span class="label_name" style="width: 100px;">单部位耗时</span>
							<el-input style="width: 65%;" v-model="addList[index].useDate" min="0" max="100" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" placeholder="请输入单部位耗时"></el-input>
							<span style="width: 50px;">min</span>
						</div>
						<div class="addLong_input" style="width: 20%;">
							<span class="label_name">能量</span>
							<el-input style="width: 65%;" v-model="addList[index].energy" min="0" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" placeholder="请输入能量"></el-input>
							<span style="width: 30px;">%</span>
						</div>
						<div class="addLong_input" style="width: 20%;">
							<span class="label_name">温度</span>
							<el-input style="width: 70%;" v-model="addList[index].temperature" min="0" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" placeholder="请输入温度"></el-input>
							<span style="width: 30px;">℃</span>
						</div>
						<div class="dislog_add">
							<el-button @click="addLong('1')">添加</el-button>
							<el-button @click="deleteClick(index, '1')">删除</el-button>
						</div>
					</div>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="submitForm()">保存</el-button>
			</span>
		</el-dialog>

		<el-dialog :title="cname" :visible.sync="dialogColor" width="1000px" :close-on-click-modal="false">
			<el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm wrap_dislog">
				<el-form-item label="方案名称" class="dislog_item" style="width: 100%;">
					<el-input v-model="planNameE" placeholder="请输入方案名称"></el-input>
				</el-form-item>
				<el-form-item label="方案标签" class="dislog_item" style="width: 100%;">
					<div class="dislog_tip">
						<el-input v-model="planLabelE" placeholder="请输入方案标签,使用'#'号隔开" style="width: 60%;" maxlength="20"></el-input>
						<span>使用#号隔开，例： 西北#年轻女性</span>
					</div>
				</el-form-item>
				<el-form-item label="方案耗点" class="dislog_item" style="width: 100%;">
					<el-input v-model="planDotE" min="0" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" type="number" placeholder="请输入方案耗点"></el-input>
				</el-form-item>
				<el-form-item label="方案总时长" class="dislog_item" style="width: 100%;">
					<el-input v-model="planDateE" min="0" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" type="number" placeholder="请输入方案总时长"></el-input>
				</el-form-item>
				<el-form-item label="选择设备类型" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="equTypeE" style="width: 100%;" placeholder="选择设备类型">
						<el-option v-for="item in deviceType" :key="item.id" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="选择自由模式" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="isOnlyE" style="width: 100%;" placeholder="是否进入自由模式">
						<el-option v-for="item in stylesSelect" :key="item.id" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>
				<!-- <el-form-item label="选择年龄段" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="editorArr.planAge" style="width: 100%;" placeholder="选择年龄段">
						<el-option v-for="item in ageList" :key="item.planAgeId" :label="item.planAgeData" :value="item.planAgeId"></el-option>
					</el-select>
				</el-form-item> -->
				<el-form-item label="选择方案类型" class="dislog_item" style="width: 100%;">
					<el-select filterable v-model="planTypeE" style="width: 100%;" placeholder="按方案类型搜索">
						<el-option v-for="(item, index) in bodysType" :key="index" :label="item.name" :value="item.id"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="方案主图" class="dislog_item">
					<el-upload class="avatar-uploader" action="https://test.beauty-iot.com/appt/api/common/uploadImage"
					 :show-file-list="false" :on-success="handleAvatarSuccess1" :before-upload="beforeAvatarUpload1">
						<img v-if="imageUrlZuo" :src="imageUrlZuo" class="avatar" />
						<i v-else class="el-icon-plus avatar-uploader-icon"></i>
					</el-upload>
				</el-form-item>
		
				<div class="addLong">
					<div class="add_wrap" v-for="(aitemE, index) in addListE" :key="index">
						
						<div class="addLong_input" style="width: 18%;">
							<span class="label_name">部位</span>
							<el-select filterable v-model="addListE[index].partType" style="width: 76%;" placeholder="选择详细部位">
								<el-option v-for="(item, index) in bodys" :key="index" :label="item.partTypeName" :value="item.partType"></el-option>
							</el-select>
						</div>
						<div class="addLong_input" style="width: 25%;">
							<span class="label_name" style="width: 100px;">单部位耗时</span>
							<el-input style="width: 65%;" v-model="addListE[index].useDate" min="0" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" placeholder="请输入单部位耗时"></el-input>
							<span style="width: 50px;">min</span>
						</div>
						<div class="addLong_input" style="width: 20%;">
							<span class="label_name">能量</span>
							<el-input style="width: 65%;" v-model="addListE[index].energy" min="0" max="999" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" placeholder="请输入能量"></el-input>
							<span style="width: 50px;">%</span>
						</div>
						<div class="addLong_input" style="width: 20%;">
							<span class="label_name">温度</span>
							<el-input style="width: 70%;" v-model="addListE[index].temperature" type="text" onkeyup="value=value.replace(/[^\d]/g,'')" max="999"  min="0" placeholder="请输入温度"></el-input>
							<span style="width: 50px;">℃</span>
						</div>
						<div class="dislog_add">
							<el-button @click="addLong('2')">添加</el-button>
							<el-button @click="deleteClick(index, '2')">删除</el-button>
						</div>
					</div>
				</div>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogColor = false">取 消</el-button>
				<el-button type="primary" @click="submitForm2()">保存</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import Cookie from 'js-cookie';
	import {
		managerListData,
		planStatus,
		addManagerPlan,
		getManagePlanMes,
		bodysList,
		ageslist,
		editManagerPlan
	} from '../../../server/index.js';
	export default {
		inject: ['reload'],
		data() {
			return {
				//查询
				search: {},
				// 设备类型
				bodysType: [{
						id: '1',
						name: '面部'
					},
					{
						id: '2',
						name: '身体'
					}
				],
				// 分页
				tableData: [],
				loading: true,
				page: {
					count: 0,
					pagesize: 10,
					page: 1
				},
				//
				openList: [{
						id: 0,
						name: '停用'
					},
					{
						id: 1,
						name: '启用'
					}
				],

				/* 上传 */
				imageUrlZuo: '',
				fileList: [],
				videoFlag: false,
				/* 上传 */

				options: [],
				options2: [],
				departmentList: [], // 部门列表

				ruleForm2: {},
				cname: '添加组织机构',
				flmc: '',

				dialogVisible: false,
				dialogColor: false,
				//新增保存字段
				ruleForm: {},
				scenarioName: '',
				planLabel: '',
				point: '',
				totelTime: '',
				bodys: [],
				deviceType: [{
						// 设备类型
						id: '1',
						name: '抗衰仪'
					}
				],
				stylesSelect: [
					{
						id: '0',
						name: '否'
					},{
						// 是否进入自由模式
						id: '1',
						name: '是'
					}
				],
				usedId: '',
				used: [
					{
						id: 0,
						name: '否'
					},{
						// 是否启用
						id: 1,
						name: '是'
					},
				],
				ageId: '',
				ageList: [],
				imageUrl: '', // 上传主图
				// 无限添加
				addList: [{
					useDate: '',
					partType: '',
					energy: '',
					temperature: ''
				}],
				editorArr: [],
				// 编辑
				planNameE:'',
				planLabelE:'',
				planDotE:'',
				planDateE:'',
				equTypeE:'',
				isOnlyE:'',
				planTypeE:'',
				addListE: [{
					useDate: '',
					partType: '',
					energy: '',
					temperature: ''
				}],
				planId: ''
			};
		},
		mounted() {
			var page = 1;
			this.columnFind(page);
			this.bodysData();
			this.agesData();
			Cookie.remove('tabList');
		},
		methods: {
			// 刷新方法
			reloadVal() {
				this.reload();
			},
			// 查询、
			searchList() {
				this.columnFind(1);
			},
			// 排序
			sortChange(sortData) { 
				console.log(sortData)
				let orderBy;
				if(sortData.order != null){
					orderBy = sortData.prop;
					if(sortData.order == 'ascending'){
						orderBy += ' asc';
					}else{
						orderBy += ' desc';
					}
				}
				this.columnFind(1,orderBy);
			},
			// 列表数据
			columnFind(page,orderFlag) {
				const _this = this;
				_this.page.page = page;
				let obj = {
					page: _this.page.page,
					rows: _this.page.pagesize,
					planName: undefined == _this.search.searchInput ? '' : _this.search.searchInput,
					planType: undefined == _this.search.bodysType ? '' : _this.search.bodysType,
					orderBy: undefined == orderFlag ? '' : orderFlag,
				};
				this.http.request({
					url: managerListData,
					data: obj,
					success: function(res) {
						_this.tableData = res.list;
						_this.loading = false;
						_this.page.count = res.total;
					},
					error: function(err) {
						_this.$message({
							offset: '200px',
							message: err.msg
						})
					}
				});
			},
			// 听启用
			changeSwitch(index, row) {
				const _this = this;
				let isEnabled = '';
				if (row.isEnabled == true) {
					isEnabled = 1;
				} else {
					isEnabled = 0;
				}
				let dataMsg = {
					planId: row.planId,
					isEnable: isEnabled
				};
				_this.http.request({
					url: planStatus,
					data: dataMsg,
					success: function(res) {
						row.isEnabled = res.isEnabled;
					},
					error: function(err) {
						_this.$message({
							offset: '200',
							message: err.msg
						})
					}
				});
			},
			/* 添加上传主图 */
			handleAvatarSuccess(res, file) {
				// console.log(file);
				this.imageUrl = file.response.data.imgUrl;
			},
			beforeAvatarUpload(file) {
				const isLt2M = file.size / 1024 / 1024 < 2;
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 2MB!');
				}
				return isLt2M;
			},
			/* 添加上传主图end */
			/* 编辑上传主图  */
			handleAvatarSuccess1(res, file) {
				this.imageUrlZuo = file.response.data.imgUrl;
			},
			beforeAvatarUpload1(file) {
				const isLt2M = file.size / 1024 / 1024 < 2;
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 2MB!');
				}
				return isLt2M;
			},
			/* 上传 */
			// 选择年龄段Age
			agesData() {
				const _this = this;
				this.http.request({
					url: ageslist,
					data: '',
					method: 'GET',
					success: function(res) {
						_this.ageList = res;
					},
					error: function(err) {
						_this.$message({
							offset: '200',
							message: err.msg
						})
					}
				});
			},
			bodysData() {
				const _this = this;
				this.http.request({
					url: bodysList,
					data: '',
					method: 'GET',
					success: function(res) {
						_this.bodys = res;
					},
					error: function(err) {
						_this.$message({
							offset: '200',
							message: err.msg
						})
					}
				});
			},
			//点击新增方案
			addColumnClick() {
				this.ruleForm = {};
				this.dialogVisible = true;
				this.cname = '新增方案';
			},
			// 新增方案
			submitForm() {
				const _this = this;
				if (!_this.ruleForm.scenarioName) {
					_this.$message({
						offset: '200',
						message: '请输入方案名称'
					})
					return;
				}
				if (!_this.ruleForm.planLabel) {
					_this.$message({
						offset: '200',
						message: '请输入方案标签'
					})
					return;
				}
				if (!_this.ruleForm.point) {
					_this.$message({
						offset: '200',
						message: '请输入方案耗点'
					})
					return;
				}
				if (!_this.ruleForm.totelTime) {
					_this.$message({
						offset: '200',
						message: '请输入方案总时长'
					})
					return;
				}
				if (!_this.ruleForm.deviceType) {
					_this.$message({
						offset: '200',
						message: '请选择设备类型'
					})
					return;
				}
				if (!_this.ruleForm.stylesSelect) {
					_this.$message({
						offset: '200',
						message: '请选择自由模式'
					})
					return;
				}
				// console.log(_this.ruleForm.planAge)
				// if (!_this.ruleForm.planAge) {
				// 	_this.$message({
				// 		offset: '200px',
				// 		message: '请选择年龄段	'
				// 	})
				// 	return;
				// }
				if (!_this.imageUrl) {
					_this.$message({
						offset: '200',
						message: '请上传方案主图'
					})
					return;
				}
				if (!_this.addList) {
					_this.$message({
						offset: '200',
						message: '请填写部位信息'
					})
					return;
				}

				let dataMsg = {
					planName: _this.ruleForm.scenarioName,
					planLabel: _this.ruleForm.planLabel,
					planDot: _this.ruleForm.point,
					planDate: _this.ruleForm.totelTime,
					equType: _this.ruleForm.deviceType,
					isOnly: _this.ruleForm.stylesSelect,
					planType: _this.ruleForm.planType,
					/* usedId: _this.usedId, */
					// planAge: _this.ruleForm.planAge,
					planImg: _this.imageUrl,
					managerPlanBodyPOJOList: _this.addList
				};
				_this.http.request({
					url: addManagerPlan,
					data: dataMsg,
					headers: {
						'Content-Type': 'application/json'
					},
					dataType: 'json',
					success: function() {
						_this.dialogVisible = false;
						_this.reload();
					},
					error: function(err) {
						_this.$message({
							offset: '200',
							message: err.msg
						})
					}
				});
			},
			// 无限添加
			addLong(index) {
				let test = {
					useDate: '',
					partType: '',
					energy: '',
					temperature: ''
				};
				if (index == 1) {
					this.addList.push(test);
				} else {
					this.addListE.push(test);
				}
			},
			// 删除
			deleteClick(res, index) {
				if (index == 1) {
					let arr1 = [];
					if (this.addList.length == 1) {
						this.$message({
							offset: '200',
							message: '最后一条不能删除'
						});
						return;
					}
					for (let i = 0; i < this.addList.length; i++) {
						if (i != res) {
							arr1.push(this.addList[i]);
						}
					}
					this.addList = arr1;
				} else {
					let arr2 = [];
					if (this.addListE.length == 1) {
						this.$message({
							offset: '200',
							message: '最后一条不能删除'
						});
						return;
					}
					for (let i = 0; i < this.addListE.length; i++) {
						if (i != res) {
							arr2.push(this.addListE[i]);
						}

					}
					this.addListE = arr2;
				}
			},
			// 点击编辑方案
			// 点击编辑方案
			cellClick(res) {
				const _this = this;
				_this.cname = '编辑方案';
				_this.dialogColor = true;
				_this.planId = res.planId;
				_this.http.request({
					url: getManagePlanMes,
					data: {
						planId: res.planId
					},
					success: function(res) {
						// 编辑
						if(res && res.planName){
							_this.planNameE = res.planName
						}
						if(res && res.planLabel){
							_this.planLabelE = res.planLabel
						}
						if(res && res.planDot){
							_this.planDotE = res.planDot
						}
						if(res && res.planDate){
							_this.planDateE = res.planDate
						}
						_this.imageUrlZuo = res.planImg;
						if (res.isOnly == false) {
							_this.isOnlyE = '否';
						} else {
							_this.isOnlyE = '是';
						}
						if (res.planType == 1) {
							_this.planTypeE = '面部';
						} else {
							_this.planTypeE = '身体';
						}
						if (res.equType == 1) {
							_this.equTypeE = '抗衰仪';
						}
						_this.addListE = res.managerPlanBodyPOJOList;
					},
					error: function(err) {
						_this.$message({
							offset: '200px',
							message: err.msg
						})
					}
				});
			},
			submitForm2() {
				const _this = this;
				if (!_this.planNameE) {
					_this.$message({
						offset: '200px',
						message: '请输入方案名称'
					});
					return;
				}
				if (!_this.planLabelE) {
					_this.$message({
						offset: '200px',
						message: '请输入方案标签'
					});
					return;
				}
				if (!_this.planDotE) {
					_this.$message({
						offset: '200px',
						message: '请输入方案耗点'
					});
					return;
				}
				if (!_this.planDateE) {
					_this.$message({
						offset: '200px',
						message: '请输入方案总时长'
					});
					return;
				}
				if (!_this.equTypeE) {
					_this.$message({
						offset: '200px',
						message: '请选择设备类型'
					});
					return;
				}
				if (!_this.isOnlyE) {
					_this.$message({
						offset: '200px',
						message: '请选择自由模式'
					});
					return;
				}
				if (!_this.planTypeE) {
					_this.$message({
						offset: '200px',
						message: '请选择方案类型'
					});
					return;
				}
				if (!_this.imageUrlZuo) {
					_this.$message({
						offset: '200px',
						message: '请上传方案主图'
					});
					return;
				}
				if (!_this.addListE) {
					_this.$message({
						offset: '200px',
						message: '请添加部位明细'
					});
					return;
				}
				let equType = '',
					isOnly = '',
					planType = '';
				console.log("自由模式="+_this.isOnlyE )
				if (_this.equTypeE == '抗衰仪') {
					equType = '1';
				}
				if (_this.isOnlyE == '0') {
					isOnly = false;
				} else {
					isOnly = true;
				}
				if (_this.planTypeE == '身体') {
					planType = '2';
				} else {
					planType = '1';
				}
				if(_this.planTypeE == '2'){
					planType = '2';
				}else{
					planType = '1';
				}
				let dataMsg = {
					planName: _this.planNameE,
					planLabel: _this.planLabelE,
					planDot: _this.planDotE,
					planDate: _this.planDateE,
					equType: equType,
					isOnly: isOnly,
					planType: planType,
					planId: _this.planId,
					planImg: _this.imageUrlZuo,
					managerPlanBodyPOJOList: _this.addListE
				};
				_this.http.request({
					url: editManagerPlan,
					data: dataMsg,
					headers: {
						'Content-Type': 'application/json'
					},
					dataType: 'json',
					success: function() {
						_this.dialogColor = false;
						_this.reload();
					},
					error: function(err) {
						_this.$message({
							offset: '200px',
							message: err.msg
						})
					}
				});
			}
		}
	};
</script>

<style scoped="scoped" lang="less">
	.el-button--primary {
		background: rgba(113, 106, 202, 1);
		border: none;
	}

	.el-button--primary:hover {
		color: #606266;
		background: rgba(255, 255, 255, 1);
		border: 1px solid rgba(113, 106, 202, 1);
	}

	.el-button--warning {
		color: #FFF;
		background-color: #F4516C;
		border-color: #F4516C;
	}
	.addLong_input{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.label_name{
		width: 40px;
		margin-right: 10px;
	}
	.wrap_dislog {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: space-between;
		align-items: center;

		.dislog_item {
			width: 45%;

			.avatar-uploader-icon {
				border: 1px dashed #8c939d;
			}

			.dislog_tip {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
			}
		}

		.addLong {
			width: 100%;
			height: 300px;
			overflow-y: auto;
			border-top: 1px solid #eeeeee;

			.add_wrap {
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				justify-content: space-between;
				align-items: center;
			}

			.dislog_item {
				width: 20%;
				margin-top: 10px;
			}

			.dislog_add {
				margin-bottom: 15px;
				margin-top: 10px;
			}
		}
	}

	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}

	.avatar-uploader .el-upload:hover {
		border-color: #409eff;
	}

	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		line-height: 178px;
		text-align: center;
	}

	.avatar {
		width: 178px;
		height: 178px;
		display: block;
	}
</style>
